<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <title>日新网</title>
    <link rel="stylesheet" href="__TMPL__Public/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/reset.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/style.css">
    <link rel="stylesheet" href="__TMPL__Public/assets/css/navpopup.css">
    <script src="__PUBLIC__/js/jquery.js"></script>
    <style>
        body{
            overflow-x: hidden;
        }
        .active {
            display: inline-block !important;
        }
        input {
            outline:none;
        }
        .nav .active {
            display:inline-block!important;
        }
        .nav a {
            display:inline-block;
            cursor: pointer;
        }
        /*修改后样式*/
        .nav {
            position: relative;
        }
        .nav .popup{
            position: absolute;
            top: 0;
            right: 0;
            background-color: #ffffff;
            box-shadow: -1px 0px 6px 0px
            rgba(0, 0, 0, 0.16);
            border-radius: 6px;
            z-index: 99999;
            text-align: center;
            font-size: 16px;
            line-height: 16px;
            color: #000232;
            padding:.12rem 0 .48rem;
            letter-spacing: 1px;
            transform: translate3d(100%,0,0);
            opacity: 0;
            transition: all .3s;
        }
        .nav .popup2{
            width: 0;
            overflow: hidden;
        }
        .nav .popup.active2 {
            width: 2.6rem;
            opacity: 1;
            transform: translate3d(0,0,0);
        }
        .nav .popup-item {
            margin-top: .5rem;
        }
        .nav .popup-item:last-child{
            margin-top: 2.84rem;

        }
        .nav .popup-item:last-child a {
            color: #c8161d;
        }
        .nav .popup .top-img-group {
            margin: 0 .48rem;
            border-bottom: 1px solid #efefef;
            height:1.06rem ;
            text-align: right;
        }
        .nav .popup .top-img-group img {
            margin: 0;
            padding: 0;

        }
        .nav .popup .top-img-group .img2 {
            /*margin-right: .48rem;*/
            width: .64rem;
            height: .64rem;
            border-radius: 50%;
            margin-left:.22rem ;
        }
        /*表示已登录 部分item 隐藏*/
        .sign-in{
            display: none;
        }
    </style>
</head>
<body>
<div class="nav nav_before">
    <a href="/"><span class="logo"></span></a>
    <p id="search">
        <input type="text">
        <i>搜索</i>
    </p>
    <!--<a href="{:U('user/profile/edit')}">-->
        <img src="/themes/simplebootx_mobile/Public/assets/images/line-icon.png" class="user-avatar" id="user-avatar" >
    <!--</a>-->
    <div class="popup popup2">
        <div class="top-img-group">
            <img class="img1" src="/themes/simplebootx_mobile/Public/assets/images/return-icon.png" alt="">
            <img class="img2" src="/themes/simplebootx_mobile/Public/assets/images/tx_icon.png" alt="">
        </div>
        <div class="popup-login popup-item no-sign-in">
            <a href="{:U('user/profile/edit')}">登陆/注册</a>
        </div>
        <div class="popup-item sign-in"><a href="{:U('user/profile/edit')}">个人中心</a></div>
        <div class="popup-item"><a href="{:U('Portal/Index/about_us')}">关于我们</a></div>
        <div class="popup-item"><a href="{:U('Portal/Index/join_us')}">联系我们</a></div>
        <div class="popup-item sign-in out-sign-in"><a href="{:U('user/index/logout')}">退出登陆</a></div>
    </div>
</div>
<script>
    var search = document.getElementById('search');
    search.addEventListener('click', function () {
        window.location.href = "{:U('portal/search/mobile_search')}";
    });

    $(document).ready(function () {
        $.post("{:U('user/index/is_login')}", {}, function (data) {
            if (data.status == 1) {
                if (data.user.avatar) {
                    $(".img2").attr("src", data.user.avatar.indexOf("http") == 0 ? data.user.avatar : "{:sp_get_image_url('[AVATAR]','!avatar')}".replace('[AVATAR]', data.user.avatar));
                }
                // 改变弹窗item显示状态
                $(".sign-in").css({
                    display:"block"
                })
                $(".no-sign-in").css({
                    display:"none"
                })
            }else {
                // 改变弹窗item显示状态
                $(".img2,.sign-in").css({
                    display:'none'
                })
                $(".no-sign-in").css({
                    display:"block"
                })
            }
        });
        $(".out-sign-in").click(function () {
            $(".sign-in").css({
                display:"none"
            })
            $(".no-sign-in").css({
                display:"block"
            })
        })
        // 弹框显示出来
        $(".user-avatar").click(function () {
            $(".popup").addClass("active2")
        })
        $(".popup .img1").click(function () {
            $(".popup").removeClass("active2")
        })
    });
</script>
</body>
</html>
